package Game;

import javax.swing.JFrame;

import Graphics.GameFrame;

public class GameDriver {
	private GameModel model;
	private GameController controller;
	private GameFrame view;
		
	public GameDriver() {
		model = new GameModel();
		controller = new GameController(model);
		view = new GameFrame(controller);
		view.setVisible(true);
		view.pack();
		view.setSize(400, 400);
		view.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);		
	}
	
	public void gameLoop() throws InterruptedException {
		while (!model.IsOver()) {			
			model.gameLoop();
			view.repaint();
			Thread.sleep(1);
		}
		
		view.dispose();
	}
	
	public static void main(String[] args) throws InterruptedException {
		GameDriver driver = new GameDriver();
		
		driver.gameLoop();
	}
}
